# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: Roberto Alsina <ralsina@kde.org>

pkgname=scponly
pkgver=4.8
pkgrel=11
pkgdesc="A limited shell for ssh/scp"
arch=(loong64 x86_64)
url="http://sublimation.org/scponly/"
depends=('glibc')
makedepends=('openssh')
license=('custom')
options=(docs)
source=(https://downloads.sourceforge.net/sourceforge/scponly/scponly-$pkgver.tgz
	setup_chroot.sh)
sha256sums=('1693dd678355749c5d9e48ecdd4628dbfe71d82955afde950ee8d88b5adc01cf'
            'c194a70d992cf265f35b70808edb6ffeac7ef321dbd6bf12038e9a55f3f6799d')

build() {
  cd "$srcdir"/$pkgname-$pkgver
  [ $NOEXTRACT -eq 1 ] || ./configure --prefix=/usr --sysconfdir=/etc \
	--enable-scp-compat --enable-winscp-compat --enable-chrooted-binary \
	--sbindir=/usr/bin
  sed -i 's|^#elif|#else|' helper.c
  make
}

package() {
  cd "$srcdir"/$pkgname-$pkgver
  make DESTDIR="$pkgdir" install
  install -D -m0644 COPYING "$pkgdir"/usr/share/licenses/scponly/COPYING
  mv "$pkgdir"/usr/man "$pkgdir"/usr/share/
  mkdir -p "$pkgdir"/usr/share/doc/scponly
  cp "$srcdir"/setup_chroot.sh config.h "$pkgdir"/usr/share/doc/scponly/
}
